package com.zzx.boot.controller;

import com.zzx.boot.servlet.BlacklistService;
import com.zzx.boot.utils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author tan
 * @version 1.0
 * @date 2023/7/10 23:56
 */
@Api(tags = "黑名单")
@RequestMapping("/black")
@RestController
public class BlackController {

    @Resource
    private BlacklistService blacklistService;

    @ApiOperation("加入黑名单")
    @PostMapping("/add/{blackId}")
    public R addBlack(@PathVariable("blackId")Long blackId){
        return R.success(blacklistService.addBlack(blackId));
    }

    @ApiOperation("拉出黑名单")
    @DeleteMapping("/del/{blackId}")
    public R removeBlack(@PathVariable("blackId")Long blackId){
        return R.success(blacklistService.removeBlack(blackId));
    }

}
